/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entities;

import com.j256.ormlite.field.DatabaseField;
import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author Juanan
 */
@Entity(name = "grp_group")
public class GrpGroup implements Serializable
{
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "GRP_ID")
    private Integer grpId;
    @Column(name = "GRP_NAME")
    private String grpName;
    @Column(name = "GRP_DESCRIPTION")
    private String grpDescription;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "grpId")
    private Collection<UsrUser> usrUserCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "grpId")
    private Collection<AccAccess> accAccessCollection;

    public GrpGroup()
    {
    }

    public GrpGroup(Integer grpId)
    {
        this.grpId = grpId;
    }

    public Integer getGrpId()
    {
        return grpId;
    }

    public void setGrpId(Integer grpId)
    {
        this.grpId = grpId;
    }

    public String getGrpName()
    {
        return grpName;
    }

    public void setGrpName(String grpName)
    {
        this.grpName = grpName;
    }

    public String getGrpDescription()
    {
        return grpDescription;
    }

    public void setGrpDescription(String grpDescription)
    {
        this.grpDescription = grpDescription;
    }

    public Collection<UsrUser> getUsrUserCollection()
    {
        return usrUserCollection;
    }

    public void setUsrUserCollection(Collection<UsrUser> usrUserCollection)
    {
        this.usrUserCollection = usrUserCollection;
    }

    public Collection<AccAccess> getAccAccessCollection()
    {
        return accAccessCollection;
    }

    public void setAccAccessCollection(Collection<AccAccess> accAccessCollection)
    {
        this.accAccessCollection = accAccessCollection;
    }

    @Override
    public int hashCode()
    {
        int hash = 0;
        hash += (grpId != null ? grpId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object)
    {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof GrpGroup))
        {
            return false;
        }
        GrpGroup other = (GrpGroup) object;
        if ((this.grpId == null && other.grpId != null) || (this.grpId != null && !this.grpId.equals(other.grpId)))
        {
            return false;
        }
        return true;
    }

    @Override
    public String toString()
    {
        return "entities.GrpGroup[ grpId=" + grpId + " ]";
    }
    
}
